/*
 * Classe DBXmlRequest
 * by CrociDB
 *
 */

#ifndef _DBXML_H_
#define _DBXML_H_

#include <iostream>
#include <winsock.h>
#include <tinyxml.h>

using namespace std;

class DBXmlRequest
{
private:
    char ip[128];
    int porta;

    SOCKET server;
    struct sockaddr_in addr;
    struct hostent *h;

    char end_file[128];

    char request[512];

    string xml;

    TiXmlDocument *tixml;
public:
    DBXmlRequest(const char* host, const char* file);
    ~DBXmlRequest();

    void setHost(const char* host);
    void setPorta(int p);
    void setFile(const char *file);

    bool Download();

    const char *getXmlString();
    TiXmlDocument *getTiXmlDocument();

    bool SaveFile(const char *filename);
};

#endif
